VideoEditor PRO
The VideoEditor API presents the system video trimming interface, letting users cut a video down to the part they want and returning the trimmed result to your script.
Namespace: VideoEditor
Overview
- Presents a full-screen trimming interface for a video file
- Users can scrub, set the in/out points, preview, then confirm or cancel
- Resolves with the file path of the trimmed video, or
nullwhen the user cancels - The trimmed video is written to a new file in the temporary directory — copy or move it if you need to keep it
- Only one editing interface can be presented at a time
- Requires a visible script UI, so it is not usable from widgets or notification scripts
API Summary
API Reference
canEditVideo(filePath: string): Promise<boolean>
Checks whether the video at the given path can be trimmed.
Parameters
Return Value
- Resolves
truewhen the video can be trimmed - Resolves
falsewhen the file does not exist or its format is not supported - Never throws
present(options: VideoEditorPresentOptions): Promise<string | null>
Presents the video trimming interface.
Parameters
VideoEditorQuality is one of:
Return Value
-
Resolves with the file path of the trimmed video when the user confirms
-
Resolves with
nullwhen the user cancels -
Throws an error when:
filePathis missing or empty- No video exists at
filePath - The video cannot be trimmed (see
canEditVideo) - An editing interface is already presented
- Trimming failed
Example
dismiss(): Promise<void>
Closes the trimming interface opened by present.
Return Value
- Resolves once the interface has been closed
- Resolves immediately when nothing is presented
Usage Notes
- The pending
presentpromise resolves withnull, as if the user cancelled - Manual dismissal is rarely needed; it is useful when a script has to close the interface on its own, for example after a timeout
Usage Examples
Example 1: Trim a video and save it
Example 2: Limit the trimmed length
Example 3: Trigger from a UI
Errors and Considerations
Common Errors
- An editor is already presented — wait for the previous
presentto settle, or calldismiss()first - No video found at the given path — check the path with
FileManagerbefore calling - The video cannot be edited — check with
canEditVideofirst
Limitations
- Only trimming is supported; the interface does not offer other editing operations
- The result is always written to a new file — the source video is never modified
- The interface needs a visible script UI, so it cannot be used in widgets or notification scripts
maximumDurationlimits the length of the trimmed result, not the length of the source video
